﻿namespace Webinator.Impls
{
    public static class Scripts
    {
        public static string
            JQuery =
            @"{var b=document.getElementsByTagName('body')[0]; if(typeof jQuery=='undefined'){var script=document"
            + @".createElement('script'); script.src='http://code.jquery.com/jquery-latest.min.js';var head=document"
            + @".getElementsByTagName('head')[0],done=false;script.onload=script.onreadystatechange=function(){if(!"
            + @"done&&(!this.readyState||this.readyState=='loaded'||this.readyState=='complete')){done=true;script."
            + @"onload=script.onreadystatechange=null;head.removeChild(script);}};head.appendChild(script);}}",
            JavascriptXPath =
            @"{var b=document.getElementsByTagName('body')[0]; "
            + @"var script=document.createElement('script'); script.src='http://svn.coderepos.org/share/lang/javascript/javascript-xpath/trunk/release/javascript-xpath-latest-cmp.js';"
            + @"var head=document.getElementsByTagName('head')[0],done=false;script.onload=script.onreadystatechange=function()"
            + @"{if(!done&&(!this.readyState||this.readyState=='loaded'||this.readyState=='complete')){done=true;"
            + @"script.onload=script.onreadystatechange=null;head.removeChild(script);}};head.appendChild(script);}",
            Message =
            @"{{var messageDiv=document.createElement('div');var body=document.getElementsByTagName('body')[0];" +
            @"var message='{0}';messageDiv.innerHTML=message;messageDiv.style.position='fixed';" +
            @"messageDiv.style.height='15px';messageDiv.style.top='0';messageDiv.style.left='0';" +
            @"messageDiv.style.width='100%';messageDiv.style.padding='5px 10px';messageDiv.style.zIndex = 99999;" +
            @"messageDiv.style.fontSize='15px';messageDiv.style.color='black';messageDiv.style.backgroundColor='#8FBC8F';" +
            @"body.appendChild(messageDiv);window.setTimeout(function() {{ body.removeChild(messageDiv); }},{1});}}";
    }
}
